const state = {
	// 存储登录信息
	userX: null,
	// 存储注册信息 [注册信息存储于数据库]
	token: ''
}
const mutations = {
	addtoken(state, str) {
		state.token = str
	},
	addUser(state,user) {
		console.log('登录');
		state.userX =user
	},
	outUser(state, user) {
		console.log('登出');
		state.userX = null
		state.token = ''
	}
}
const actions = {
	// 对接登录的操作
	ToKen({
		state,
		commit
	}, str) {
		commit('addtoken', str)
	},
	User({seate,commit}, obj) {
		console.log(obj);
		if (obj == null) {
			commit('outUser', obj)
		} else {
			commit('addUser', obj)
		}
		
	}

}
export default {
	namespaced: true,
	state,
	mutations,
	actions
}